package com.rockcent.mall.lib.domain;

import com.rockcent.common.domain.IDEntityMall;
import com.rockcent.mall.lib.domain.enumclass.CashCouponStatus;
import com.rockcent.mall.lib.domain.enumclass.FaceValueType;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 现金券
 * Created by zhangjh on 2016/12/14.
 */
@Entity
@Table(name = "mall_cash_coupon")
@DynamicInsert(value = true)
@DynamicUpdate(value = true)
public class MallCashCoupon extends IDEntityMall {

    /**
     * 平台ID
     */
    @Column(columnDefinition = "bigint(20) comment '平台ID'")
    private Long mallId;

    /**
     * 现金券
     */
    @Column(columnDefinition = "varchar(200) comment '现金券'")
    private String name;

    /**
     * 面值
     */
    @Column(columnDefinition = "DECIMAL(30,10) comment '面值'")
    private BigDecimal faceValue;

    /**
     * 发放数量
     */
    @Column(columnDefinition = "bigint comment '发放数量'")
    private Long quantity;

    /**
     * 剩余数量
     */
    @Column(columnDefinition = "bigint comment '剩余数量'")
    private Long leaveTotal;

    @Column(columnDefinition = "varchar(30) comment '状态 WAIT_ISSUE(\"待发放\"), ISSUED(\"已发放\"), SOLDOUT(\"已下架\"), EXPIRED(\"已过期\"), DELETED(\"已删除\")'")
    @Enumerated(EnumType.STRING)
    private CashCouponStatus status;

    /**
     * 有效期开始时间
     */
    @Column(columnDefinition = "datetime comment '有效期开始时间'")
    private Date dateEnabled;

    /**
     * 有效期结束时间
     */
    @Column(columnDefinition = "datetime comment '有效期结束时间'")
    private Date dateDisabled;


    /**
     * 积分渠道id
     */
    @Column(columnDefinition = "bigint comment '积分渠道id'")
    private Long integrationChannelId;


    /**
     * 兑换数量：在积分渠道兑换的情况
     */
    @Column(columnDefinition = "bigint comment '兑换数量'")
    private Long exchangeNum;

    /**
     * 领取数量：到平台兑换，叫领取
     */
    @Column(columnDefinition = "bigint comment '领取数量'")
    private Long receiveNum;

    /**
     * 使用数量
     */
    @Column(columnDefinition = "bigint comment '使用数量'")
    private Long useNum;

    /**
     * 投放批次号
     */
    @Column(columnDefinition = "bigint comment '投放批次号'")
    private Long batchPutNo;

    /**
     * 图片地址
     */
    @Column(columnDefinition = "varchar(255) comment '图片地址'")
    private String picUrl;

    public Long getMallId() {
        return mallId;
    }

    public void setMallId(Long mallId) {
        this.mallId = mallId;
    }


    public BigDecimal getFaceValue() {
        return faceValue;
    }

    public void setFaceValue(BigDecimal faceValue) {
        this.faceValue = faceValue;
    }

    public Long getQuantity() {
        return quantity;
    }

    public void setQuantity(Long quantity) {
        this.quantity = quantity;
    }

    public Long getLeaveTotal() {
        return leaveTotal;
    }

    public void setLeaveTotal(Long leaveTotal) {
        this.leaveTotal = leaveTotal;
    }

    public CashCouponStatus getStatus() {
        return status;
    }

    public void setStatus(CashCouponStatus status) {
        this.status = status;
    }

    public Date getDateEnabled() {
        return dateEnabled;
    }

    public void setDateEnabled(Date dateEnabled) {
        this.dateEnabled = dateEnabled;
    }

    public Date getDateDisabled() {
        return dateDisabled;
    }

    public void setDateDisabled(Date dateDisabled) {
        this.dateDisabled = dateDisabled;
    }

    public Long getIntegrationChannelId() {
        return integrationChannelId;
    }

    public void setIntegrationChannelId(Long integrationChannelId) {
        this.integrationChannelId = integrationChannelId;
    }

    public Long getExchangeNum() {
        return exchangeNum;
    }

    public void setExchangeNum(Long exchangeNum) {
        this.exchangeNum = exchangeNum;
    }

    public Long getReceiveNum() {
        return receiveNum;
    }

    public void setReceiveNum(Long receiveNum) {
        this.receiveNum = receiveNum;
    }

    public Long getUseNum() {
        return useNum;
    }

    public void setUseNum(Long useNum) {
        this.useNum = useNum;
    }

    public Long getBatchPutNo() {
        return batchPutNo;
    }

    public void setBatchPutNo(Long batchPutNo) {
        this.batchPutNo = batchPutNo;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPicUrl() {
        return picUrl;
    }

    public void setPicUrl(String picUrl) {
        this.picUrl = picUrl;
    }

    @Override
    public String toString() {
        return "MallCashCoupon{" +
                "id=" + id +
                ", mallId=" + mallId +
                ", dateCreated=" + dateCreated +
                ", name='" + name + '\'' +
                ", lastUpdated=" + lastUpdated +
                ", faceValue=" + faceValue +
                ", isDelete=" + isDelete +
                ", quantity=" + quantity +
                ", version=" + version +
                ", leaveTotal=" + leaveTotal +
                ", status=" + status +
                ", dateEnabled=" + dateEnabled +
                ", dateDisabled=" + dateDisabled +
                ", integrationChannelId=" + integrationChannelId +
                ", exchangeNum=" + exchangeNum +
                ", receiveNum=" + receiveNum +
                ", useNum=" + useNum +
                ", batchPutNo=" + batchPutNo +
                ", picUrl='" + picUrl + '\'' +
                '}';
    }
}
